<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

         <!--app-->
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <link rel="stylesheet" href="css/appcan.icon.css">
        <link rel="stylesheet" href="css/appcan.control.css">
        <link rel="stylesheet" href="css_sdk/css/main.css">
        <link rel="stylesheet" href="test_content/css/login.css">
           <!--amazeui-->
        <link rel="stylesheet" href="assets/css/amazeui.min.css">
        <link rel="stylesheet" href="assets/css/app.css">
        <script src="js/jquery-1.8.3.min.js"></script>
        <style>
            .am-header-default {
                background-color: #eb1111;
            }
            .bc-btn {
                background-color: #eb1111;
            }
            .logo {
                background-image: url('images/logo.png');
            }
            .umhw1 {
                min-height: 9.16em;
                min-width: 13.5em;
            }
            
            .umar-a {
                margin: 1em;
            }
            .uinn {
                padding: 0.2em;
                margin: 0;
            }
        </style>
</head>


<body class="um-vp bc-bg" >

        <div id="page_0" class="up ub ub-ver" tabindex="0">
            
         <header data-am-widget="header" class="am-header am-header-default">
            <h1 class="am-header-title">
                <a href="#title-link" class="">
                  登录
                </a>
            </h1>

        </header>
            
            
            <div id="content" class="ub-f1 tx-l ub ub-ver c-wh1" >
                <div class="uinn ub ub-ac ub-pc">
                    <div class="logo ub-img umhw1"></div>
                </div>
                <div class="uinn ub ub-ac ub-pc ub-ver">
                    <div class="ulev0 t-blu " style="color:gray">
                       广州孙雨汐生物科技有限公司
                    </div>
                    <div class="ulev1 t-blu  uinn" style="color:#eb1111">
                        
                    </div>
                </div>
                <div class="ub ub-ver ub-f1 " >
                    <form method="get" action="">
                        <div class="uba b-gra umar-a uc-a1 c-wh " style=" background-color: white;">
                            <div class="ub ">
                                <div class="umhw resuser ub-img umar-l"></div>
                                <div class="ub-f1 uinput uinn">
                                    <input placeholder="请输入会员号" id="uid"  value="" type="text" class="uc-a1">
                                </div>
                            </div>
                        </div>
                        <div class="uba b-gra umar-a uc-a1 c-wh" style=" background-color: white;">
                            <div class="ub ub-ac">
                                <div class="umhw respwd ub-img umar-l"></div>
                                <div class="ub-f1 uinput uinn">
                                    <input placeholder="请输入密码" id="upwd"  value="" type="password" class="uc-a1">
                                </div>
                            </div>
                        </div>
                       
                        <div class="uin uinn ub" style="margin-top:2.5em">
                            <div class="ub-f2"></div>
                            <div class="btn ub-f2 ub ub-ac bc-text-head ub-pc bc-btn uc-a1"  id="submit" onclick="click_sub()">
                                登　录
                            </div>
                             <div class="ub-f2"></div>
                        </div>
                        
                        <button type="submit"class="uinvisible"></button>
                    </form>
                </div>
            </div>
            <div id="footer" class=""></div>
        </div>
    <script>
        function click_sub(){
            var uid=$("#uid").val();
            var upwd=$("#upwd").val();
            if (uid!=""&&upwd!=""){
                $.ajax({
                    type: 'POST',
                    url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/LoginWebService/LoginChk" ,
                    data: {"tUser":uid,"tPwd":upwd},
                    success: function(data){
                        //是否登陆成功
                        var f1 = data[0]["loginModelLise"][0]["f1"];
                        //用户ID
                        var f2 = data[0]["loginModelLise"][0]["f2"];
                        //角色
                        var f3 = data[0]["loginModelLise"][0]["f3"];
                        //用户名
                        var f4 = data[0]["loginModelLise"][0]["f4"];
                        //日利润
                        var f5 = data[0]["loginModelLise"][0]["f5"];
                        //等级名
                        var f6 = data[0]["loginModelLise"][0]["f6"];
                        //加盟店数量
                        var f7 = data[0]["loginModelLise"][0]["f7"];
                        //角色名称
                        var f8 = data[0]["loginModelLise"][0]["f8"];
                        if (f1==1){
                            //购物车数量
//                            var cart_num=data[0]["cartList"][0]["f1"];
//                            alert(cart_num);
                            localStorage.setItem("user", f2);
//                            sessionStorage.setItem("cart_num", cart_num);
                            localStorage.setItem("role", f3);
                            sessionStorage.setItem("username", f4);
                            sessionStorage.setItem("price", f5);
                            sessionStorage.setItem("num", f7);
                            sessionStorage.setItem("role_name", f8);
                            localStorage.setItem("username", uid);
                            localStorage.setItem("password", upwd);
                            window.location.href="home.html";
                        }else if(f1==2){
                            sessionStorage.setItem("user", f2);
                            alert("您是初次登入，请先修改您的密码！");
                             window.location.href="init_pass.html";
                        }
                        else if(f1==-1){
                            alert("用户名不存在！");
                        }else if(f1==-2){
                            alert("密码错误！");
                        }
                        //ZJXS admin1234
//                        alert(data[0]["loginModelLise"]);
//                        //添加key-value 数据到 sessionStorage
//                        sessionStorage.setItem("demokey", "http://blog.itjeek.com");
//                        sessionStorage.setItem("user","我")
//                        //通过key来获取value
//                        var dt = sessionStorage.getItem("demokey");
//                        var dt2 = sessionStorage.getItem("user");
//                        alert(dt);
//                        alert(dt2);
                    },
                    dataType: "json",
               });                
            }else{
                alert("用户和密码不得为空！")
            }
//            window.location.href="home.html";
        }
    </script>

</body>
</html>
